package com.leo.corelib.utils;

import android.content.Context;
import android.widget.Toast;

/**
 * author: Leo Liao
 * created on: 22/07/2021 16:24
 * description:
 */
public class ToastUtils {
    private static ToastUtils instance;
    private static Toast toast;

    private ToastUtils() {

    }

    public static synchronized void showToast(Context context, String msg) {
        if (toast == null) {
            toast = Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_SHORT);
        } else {
            toast.setText(msg);
        }
        toast.show();
    }
}
